<template>
    <div>
        <back></back>
        <div class="promptList">
            <div class="promptBox" v-for="(item,key,index) of dataList" :key="item.index" v-if="type ==1">
                <p>您的客户{{item.truename | name}}{{item.days|time}} </p>
                <svg class="icon" aria-hidden="true">
                    <use xlink:href="#icon-fexpire"></use>
                </svg>
                <span>您的客户{{item.truename|nameShow}}{{item.bidName|bidName}}{{item.endIntentDate|endIntentDate}}请留意！</span>
            </div>
            <div class="promptBox" v-for="(item,key,index) of dataList" :key="item.index" v-else>
                <p>您的客户{{item.truename | name2}}{{item.days|time2}} </p>
                <svg class="icon" aria-hidden="true">
                    <use xlink:href="#icon-brithday"></use>
                </svg>
                <span>您的客户{{item.truename|nameShow}}{{item.birthDate}}，请留意！</span>
            </div>
            <div class="moreBtn" @click="getlist">{{noMore}}</div>
        </div>
    </div>
</template>
<script>
import qs from "qs"
import back from "@/components/common/back"

export default {
    components: { back },

    data() {
        return {
            memberId: window.localStorage.memberId,
            type: this.$route.params.type,
            page: 1,
            noMore: "点击加载更多",
            dataLength: 16,
            loadType: false,
            url: "",
            dataList: []
        }
    },
    filters: {
        name: function (value) {
            return value + "的投资还有"
        },
        time: function (value) {
            return value + "天到期"
        },
        nameShow: function (value) {
            return value + "投资的"
        },
        bidName: function (value) {
            return value + "将于"
        },
        endIntentDate: function (value) {
            return value + "到期，"
        },
        name2: function (value) {
            return value + "还有"
        },
        time2: function (value) {
            return value + "天过生日"
        },
        nameShow2: function (value) {
            return value + "生日是"
        },
    },
    mounted() {
        this.getlist();
    },

    methods: {
        getlist() {
            this.noMore = "正在加载数据中";
            if (this.loadType) {
                return
            }
            // if (this.page * this.limit >= this.dataLength + this.limit) {
            //     this.noMore = "没有更多数据了";
            //     return
            // }
            this.loadType = true;
            if (this.type == 1) {
                this.url = "/salesman/getInvestPersonDeadlineListSalesman.do"
            } else {
                this.url = "/salesman/getInvestPersonBirthdaySalesman.do"
            }
            let param = {
                isMobile: 1,
                memberId: this.memberId,
                page: this.page,
                limit: 10
            }
            param = qs.stringify(param);
            this.$ajax.post(this.url, param).then(response => {
                this.loadType = false;
                this.noMore = "点击加载数据";
                this.dataList = this.dataList.concat(response.data.data);
                this.page++;
                if (response.data.data == [] || response.data.data.length < this.limit) {
                    this.noMore = "没有更多数据了";
                    return
                }
            })
        }
    }
}
</script>
<style>
.promptBox {
    width: 91.6%;
    background: white;
    margin: .5rem auto;
    padding: .36rem .33rem;
    font-size: .25rem;
    color: #333
}

.promptBox p {
    font-size: .3rem;
    color: black;
    margin-bottom: .3rem
}

.promptBox .icon {
    font-size: 1.1rem;
    padding: .1rem .2rem;
    background: #ffa508;
    border-radius: 5px;
    color: white
}

.promptBox span {
    position: relative;
    display: inline-block;
    width: 70%;
    top: -.25rem;
    left: .2rem
}
</style>

